/**
 * UserMapper.java
 * 
 * Copyright@2015 OVT Inc. All rights reserved. 
 * 
 * May 5, 2015
 */
package com.ovt.doorbell.payment.dao.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.ovt.doorbell.payment.dao.constant.DBConstants;
import com.ovt.doorbell.payment.dao.vo.Resource;
import com.ovt.doorbell.payment.dao.vo.User;

/**
 * UserMapper
 * 
 * @Author zhi.liu
 * @Version 1.0
 * @See
 * @Since [OVT Cloud Platform]/[DAO] 1.0
 */
public class ResourceMapper implements RowMapper<Resource>
{

    /*
     * (non-Javadoc)
     * 
     * @see org.springframework.jdbc.core.RowMapper#mapRow(java.sql.ResultSet,
     * int)
     */
    public Resource mapRow(ResultSet rs, int rowNum) throws SQLException
    {
        Resource resource = new Resource();
        resource.setId(rs.getLong(DBConstants.TABLES.RESOURCE.ID));
        resource.setName(rs.getString(DBConstants.TABLES.RESOURCE.RES_NAME));
        resource.setCode(rs.getString(DBConstants.TABLES.RESOURCE.RES_CODE));
        resource.setType(rs.getString(DBConstants.TABLES.RESOURCE.RES_TYPE));
        resource.setPrice(rs.getFloat(DBConstants.TABLES.RESOURCE.RES_PRICE));
        resource.setSize(rs.getInt(DBConstants.TABLES.RESOURCE.RES_SIZE));
        resource.setUnit(rs.getString(DBConstants.TABLES.RESOURCE.RES_UNIT));
        resource.setCreateTime(rs.getTimestamp(DBConstants.TABLES.RESOURCE.CREATE_TIME));
        resource.setUpdateTime(rs.getTimestamp(DBConstants.TABLES.RESOURCE.UPDATE_TIME));
        resource.setUpdateBy(rs.getInt(DBConstants.TABLES.RESOURCE.UPDATE_BY));
        
        return resource;
    }

}
